/*
 * Singularity Engine
 * Copyright (C) 2010 Vyacheslav Vorobyov, All rights reserved.
 * See LICENSE for full license information.
 */

/**
 * 
 */
package org.singularity.mapred.framework;


import java.io.IOException;

import org.singularity.io.CloseablePipe;

/**
 * @author vjache
 *
 */
public abstract class DemultiplexerPipe<T> implements CloseablePipe<T> {

	/**
	 * 
	 */
	protected DemultiplexerPipe() {
	}

	/* (non-Javadoc)
	 * @see org.singularity.mapred.Pipe#push(java.lang.Object)
	 */
	@Override
	public void push(T aItem) throws IOException {
		selectFor(aItem).push(aItem);
	}
	abstract protected CloseablePipe<T> selectFor(T aItem);
//	protected Pipe<T> selectFor(T aItem)
//	{
//		int i = aItem.hashCode() % _destPipes.length;
//		return _destPipes[i];
//	}

}
